use crate::model::RespVO;
use crate::APPLICATION_CONTEXT;
use ntex::web::{get, Responder, ServiceConfig};

#[get("/get_captcha/{tag}")]
pub async fn get_captcha_handle() -> impl Responder {
    let captcha = &APPLICATION_CONTEXT.captcha_service.get_captcha().await;
    RespVO::from_result(&captcha).resp_json()
}

pub fn captcha(cfg: &mut ServiceConfig) {
    cfg.service(get_captcha_handle);
}
